import Layout from '@/layout'

const authRouter = {
  path: '/auth',
  component: Layout, // Parent router-view
  name: 'auth_mgr',
  meta: { title: '权限控制', icon: 'auth', permissions: ['sys:auth:role:list', 'sys:auth:permission:list', 'sys:auth:resource:list'] },
  redirect: '/auth/role/list',
  children: [
    {
      path: 'role',
      component: () => import('@/views/sys/auth/role/index'),
      name: 'role_mgr',
      meta: { title: '角色管理', permissions: ['sys:auth:role:list'] },
      redirect: 'list',
      children: [
        {
          path: 'list',
          component: () => import('@/views/sys/auth/role/list'),
          name: 'role_mgr_list',
          meta: { title: '角色管理', icon: 'ljm-role', permissions: ['sys:auth:role:list'] }
        },
        {
          path: 'add',
          component: () => import('@/views/sys/auth/role/add'),
          name: 'role_mgr_add',
          meta: { title: '新增角色', permissions: ['sys:auth:role:add'] },
          hidden: true
        },
        {
          path: 'edit',
          component: () => import('@/views/sys/auth/role/edit'),
          name: 'role_mgr_edit',
          meta: { title: '修改角色', permissions: ['sys:auth:role:edit'] },
          hidden: true
        },
        {
          path: 'view',
          component: () => import('@/views/sys/auth/role/view'),
          name: 'role_mgr_view',
          meta: { title: '角色信息', permissions: ['sys:auth:role:view'] },
          hidden: true
        },
        {
          path: 'authorization',
          component: () => import('@/views/sys/auth/role/roleRes'),
          name: 'role_mgr_permission',
          meta: { title: '授权', permissions: ['sys:auth:role:authorize'] },
          hidden: true
        },
        {
          path: 'userRef',
          component: () => import('@/views/sys/auth/role/userRef'),
          name: 'role_mgr_userRef',
          meta: { title: '指派', permissions: ['sys:auth:role:appoint'] },
          hidden: true
        }
      ]
    },
    {
      path: 'resource',
      component: () => import('@/views/sys/auth/resource/index'),
      name: 'resource_mgr',
      meta: { title: '资源管理', icon: 'ljm-resource', permissions: ['sys:auth:resource:list'] },
      redirect: 'list',
      children: [
        {
          path: 'list',
          component: () => import('@/views/sys/auth/resource/list'),
          name: 'resource_mgr_list',
          meta: { title: '资源管理', icon: 'ljm-resource', permissions: ['sys:auth:resource:list'] }
        },
        {
          path: 'add',
          component: () => import('@/views/sys/auth/resource/add'),
          name: 'resource_mgr_add',
          meta: { title: '新增资源', permissions: ['sys:auth:resource:add'] },
          hidden: true
        },
        {
          path: 'edit',
          component: () => import('@/views/sys/auth/resource/edit'),
          name: 'resource_mgr_edit',
          meta: { title: '修改资源', permissions: ['sys:auth:resource:edit'] },
          hidden: true
        },
        {
          path: 'view',
          component: () => import('@/views/sys/auth/resource/view'),
          name: 'resource_mgr_view',
          meta: { title: '资源详情', permissions: ['sys:auth:resource:view'] },
          hidden: true
        }
      ]
    }
  ]
}

export default authRouter
